home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 1 / BBS in a box - Trilogy I.iso / Files / QuickTime / QT Tools / QuickTime Interfacing / Components.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-20  |  8.1 KB  |  240 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Friday, October 2, 1992 at 11:39 AM
  4.  Components.h
  5.  C Interface to the Macintosh Libraries
  6.  
  7.  
  8.  Copyright Apple Computer, Inc. 1991, 1992
  9.  All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13. #ifndef __COMPONENTS__
  14. #define __COMPONENTS__
  15.  
  16. #ifndef __TYPES__
  17. #include <Types.h>
  18. #endif
  19.  
  20. #ifndef __MEMORY__
  21. #include <Memory.h>
  22. #endif
  23.  
  24. #ifndef kSmallestArray
  25.     #define kSmallestArray 1
  26. #endif
  27.  
  28. #define gestaltComponentMgr 'cpnt'
  29.  
  30. #define    kAnyComponentType            0
  31. #define    kAnyComponentSubType        0
  32. #define    kAnyComponentManufacturer    0
  33. #define    kAnyComponentFlagsMask        0
  34.  
  35. #define cmpWantsRegisterMessage 1L<<31
  36.  
  37. typedef struct
  38.     {
  39.     OSType componentType;                    /* A unique 4-byte code indentifying the command set */
  40.     OSType componentSubType;                /* Particular flavor of this instance */
  41.     OSType componentManufacturer;            /* Vendor indentification */
  42.     unsigned long componentFlags;            /* 8 each for Component,Type,SubType,Manuf/revision */
  43.     unsigned long componentFlagsMask;        /* Mask for specifying which flags to consider in search, zero during registration */
  44.     } ComponentDescription;
  45.  
  46.  
  47. typedef struct
  48.     {
  49.     OSType resType;                            /* 4-byte code     */
  50.     short resID;                            /*              */
  51.     } ResourceSpec;
  52.  
  53.  
  54. struct ComponentResource {
  55.     ComponentDescription cd;                /* Registration parameters */
  56.     ResourceSpec component;                    /* resource where Component code is found */
  57.     ResourceSpec componentName;                /* name string resource */
  58.     ResourceSpec componentInfo;                /* info string resource */
  59.     ResourceSpec componentIcon;                /* icon resource */
  60. };
  61. typedef struct ComponentResource ComponentResource;
  62. typedef ComponentResource *ComponentResourcePtr, **ComponentResourceHandle;
  63.  
  64.  
  65. #ifndef _PrivateThingManager_
  66.     typedef struct privateComponentRecord *Component;
  67.     typedef struct privateComponentInstanceRecord *ComponentInstance;
  68. #endif _PrivateThingManager_
  69.  
  70.  
  71. /*  Structure received by Component:        */
  72.  
  73. typedef struct
  74.     {
  75.     unsigned char flags;                /* call modifiers: sync/async, deferred, immed, etc */
  76.     unsigned char paramSize;            /* size in bytes of actual parameters passed to this call */
  77.     short what;                            /* routine selector, negative for Component management calls */
  78.     long params[kSmallestArray];        /* actual parameters for the indicated routine */
  79.     } ComponentParameters;
  80.  
  81.  
  82. typedef long ComponentResult;
  83.  
  84. typedef pascal ComponentResult (*ComponentRoutine)
  85.         (ComponentParameters *cp, Handle componentStorage );
  86.  
  87. typedef pascal ComponentResult (*ComponentFunction)();
  88.  
  89.  
  90.  
  91. #define ComponentCallNow(callNumber, paramSize) {0x2f3c,paramSize,callNumber,0x7000,0xA82A}
  92.  
  93. /********************************************************
  94. * Required Component routines
  95. ********************************************************/
  96.  
  97. #define kComponentOpenSelect     -1            /* ComponentInstance for this open */
  98. #define kComponentCloseSelect     -2            /* ComponentInstance for this close */
  99. #define kComponentCanDoSelect     -3            /* selector # being queried */
  100. #define kComponentVersionSelect     -4            /* no params */
  101. #define kComponentRegisterSelect -5            /* no params */
  102. #define kComponentTargetSelect      -6            /* ComponentInstance for top of call chain */
  103.  
  104. enum {                /* Set Default Component flags */
  105.     defaultComponentIdentical        = 0,
  106.     defaultComponentAnyFlags        = 1,
  107.     defaultComponentAnyManufacturer    = 2,
  108.     defaultComponentAnySubType        = 4
  109.     };
  110.     
  111. #define defaultComponentAnyFlagsAnyManufacturer defaultComponentAnyFlags+defaultComponentAnyManufacturer
  112. #define defaultComponentAnyFlagsAnyManufacturerAnySubType  defaultComponentAnyFlags+defaultComponentAnyManufacturer+defaultComponentAnySubType
  113.  
  114. enum {                    /* errors from component manager & components  */
  115.     invalidComponentID = -3000,
  116.     validInstancesExist = -3001,
  117.     componentNotCaptured = -3002,
  118.     componentDontRegister = -3003
  119. };
  120.  
  121. #define badComponentInstance    0x80008001
  122. #define badComponentSelector    0x80008002
  123.  
  124. #ifdef __cplusplus
  125. extern "C" {
  126. #endif __cplusplus
  127.  
  128. /********************************************************
  129. *                                                        *
  130. *                  APPLICATION LEVEL CALLS                    *
  131. *                                                        *
  132. ********************************************************/
  133.  
  134. /********************************************************
  135. * Component Database Add, Delete, and Query Routines 
  136. ********************************************************/
  137.  
  138. pascal Component RegisterComponent(ComponentDescription *cd, ComponentRoutine componentEntryPoint, short global, Handle componentName, Handle componentInfo, Handle componentIcon)
  139.         = {0x7001,0xA82A};
  140. pascal Component RegisterComponentResource(ComponentResourceHandle cr, short global)
  141.         = {0x7012,0xA82A};
  142. pascal OSErr UnregisterComponent(Component aComponent)
  143.         = {0x7002,0xA82A};
  144.  
  145. pascal Component FindNextComponent(Component aComponent, ComponentDescription *looking)
  146.         = {0x7004,0xA82A};
  147. pascal long CountComponents(ComponentDescription *looking)
  148.         = {0x7003,0xA82A};
  149.  
  150. pascal OSErr GetComponentInfo(Component aComponent, ComponentDescription *cd, Handle componentName, Handle componentInfo, Handle componentIcon)
  151.         = {0x7005,0xA82A};
  152. pascal long GetComponentListModSeed( void )
  153.         = {0x7006,0xA82A};
  154.  
  155. /********************************************************
  156. * Component Instance Allocation and dispatch routines 
  157. ********************************************************/
  158.  
  159. pascal ComponentInstance OpenComponent(Component aComponent)
  160.         = {0x7007,0xA82A};
  161. pascal OSErr CloseComponent(ComponentInstance aComponentInstance)
  162.         = {0x7008,0xA82A};
  163.  
  164. pascal OSErr GetComponentInstanceError(ComponentInstance aComponentInstance)
  165.         = {0x700A,0xA82A};
  166.  
  167. /* direct calls to the Components */
  168.  
  169. pascal long ComponentFunctionImplemented(ComponentInstance ci, short ftnNumber) = {0x2F3C,0x2,0xFFFD,0x7000,0xA82A};
  170. pascal long GetComponentVersion(ComponentInstance ci) = {0x2F3C,0,0xFFFC,0x7000,0xA82A};
  171. pascal long ComponentSetTarget(ComponentInstance ci, ComponentInstance target) = {0x2F3C,0x4,0xFFFA,0x7000,0xA82A};
  172.  
  173.  
  174. /********************************************************
  175. *                                                        *
  176. *                      CALLS MADE BY ComponentS                  *
  177. *                                                        *
  178. ********************************************************/
  179.  
  180. /********************************************************
  181. * Component Management routines
  182. ********************************************************/
  183.  
  184. pascal void SetComponentInstanceError(ComponentInstance aComponentInstance, OSErr theError)
  185.         = {0x700B,0xA82A};
  186.  
  187. pascal long GetComponentRefcon(Component aComponent)
  188.         = {0x7010,0xA82A};
  189. pascal void SetComponentRefcon(Component aComponent, long theRefcon)
  190.         = {0x7011,0xA82A};
  191.  
  192. pascal short OpenComponentResFile(Component aComponent)
  193.         = {0x7015,0xA82A};
  194. pascal OSErr CloseComponentResFile(short refnum)
  195.         = {0x7018,0xA82A};
  196.  
  197. /********************************************************
  198. * Component Instance Management routines
  199. ********************************************************/
  200.  
  201. pascal Handle GetComponentInstanceStorage(ComponentInstance aComponentInstance)
  202.         = {0x700C,0xA82A};
  203. pascal void SetComponentInstanceStorage(ComponentInstance aComponentInstance, Handle theStorage)
  204.         = {0x700D,0xA82A};
  205.  
  206. pascal long GetComponentInstanceA5(ComponentInstance aComponentInstance)
  207.         = {0x700E,0xA82A};
  208. pascal void SetComponentInstanceA5(ComponentInstance aComponentInstance, long theA5)
  209.         = {0x700F,0xA82A};
  210.  
  211. pascal long CountComponentInstances(Component aComponent)
  212.         = {0x7013,0xA82A};
  213.  
  214. /* useful helper routines for convenient method dispatching */
  215.  
  216. pascal long CallComponentFunction(ComponentParameters *params, ComponentFunction func ) = {0x70FF,0xA82A};
  217. pascal long CallComponentFunctionWithStorage(Handle storage, ComponentParameters *params, ComponentFunction func ) = {0x70FF,0xA82A};
  218.  
  219. pascal long DelegateComponentCall( ComponentParameters *originalParams, ComponentInstance ci ) = {0x7024,0xA82A};
  220.  
  221. pascal OSErr SetDefaultComponent( Component aComponent, short flags )
  222.         = {0x701E,0xA82A};
  223. pascal ComponentInstance OpenDefaultComponent( OSType componentType, OSType componentSubType )
  224.         = {0x7021,0xA82A};
  225.  
  226. pascal Component CaptureComponent( Component capturedComponent, Component capturingComponent )
  227.         = {0x701C,0xA82A};
  228. pascal OSErr UncaptureComponent( Component aComponent )
  229.         = {0x701D,0xA82A};
  230.  
  231. pascal long RegisterComponentResourceFile(short resRefNum, short global)
  232.         = {0x7014,0xA82A};
  233.  
  234.  
  235. #ifdef __cplusplus
  236. }
  237. #endif __cplusplus
  238.  
  239. #endif __COMPONENTS__
  240.